<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:p="http://primefaces.org/ui">

<h:head>
	<h:outputStylesheet library="css" name="estilo.css" />
</h:head>

<h:body>

	<div class="divClear">
		<p:separator />
		<p:toolbar>
			<p:toolbarGroup align="left">
				<div>
					<div class="divFloatLeft">
						<ui:insert name="imagem">
							<h:graphicImage library="images" name="window.png" width="64"
								height="64" />
						</ui:insert>
					</div>
					<div id="div_titulo">
						<ui:insert name="titulo">
								Nome janela		
						</ui:insert>
					</div>
				</div>
			</p:toolbarGroup>
		</p:toolbar>


		<div id="corpoWindow">
			<h:form id="formTemplate">

				<p:growl id="growl" showDetail="true"  life="5000" />

				<div class="divFloatHalfLeft">
					<p:dataTable id="dataTable" value="#{manageBean.list}"
						var="gridEntity" emptyMessage="Não há dados a serem listados"
						rowKey="#{gridEntity.id}" selection="#{manageBean.entity}"
						widgetVar="tableField" selectionMode="single" rows="10">

						<f:facet name="header">

							<div class="divAlignRight">
								<p:outputPanel>
									<h:outputText value="Buscar por: " />
									<p:inputText id="globalFilter" onkeyup="tableField.filter()"
										style="width:150px" />
								</p:outputPanel>
							</div>
						</f:facet>

						<p:ajax event="rowSelect" update=":formTemplate:panelCampos" />

						<ui:insert name="colunas" />

					</p:dataTable>

				</div>

				<div class="divFloatHalfRight">
					<div class="divAlignRight">
						<p:outputPanel id="panel" autoUpdate="true">

							<p:commandButton value="Novo" update="panelCampos panel"
								disabled="false" actionListener="#{manageBean.create}"
								rendered="#{!manageBean.editMode}" process="@this" />

							<p:commandButton value="Editar" update="panelCampos panel"
								disabled="false" actionListener="#{manageBean.update}"
								rendered="#{!manageBean.editMode}" process="@this" />

							<p:commandButton value="Apagar"
								onclick="confirmationDelete.show()" disabled="false"
								type="button" rendered="#{!manageBean.editMode}" process="@this" />


							<p:confirmDialog id="confirmDialog" header="Exclusão de Registro"
								message="Deseja excluir o registro selecionado?"
								style="text-align: right" severity="alert"
								widgetVar="confirmationDelete">

								<p:commandButton id="confirm" value="Sim"
									update=":formTemplate " oncomplete="confirmationDelete.hide()"
									actionListener="#{manageBean.delete}" process="@this" />

								<p:commandButton id="decline" value="Não"
									onclick="confirmationDelete.hide()" type="button" />

							</p:confirmDialog>


							<p:commandButton value="Salvar" onclick="blockCampos.show()"
								update=":formTemplate" disabled="false"
								actionListener="#{manageBean.salvar}"
								rendered="#{manageBean.editMode}" />

							<p:commandButton value="Cancelar" onclick="blockCampos.show()"
								update="panelCampos panel" disabled="false"
								actionListener="#{manageBean.cancel}"
								rendered="#{manageBean.editMode}" process="@this" />



							<p:blockUI block="panelCampos" widgetVar="blockCampos" />

						</p:outputPanel>

					</div>

					<p:separator />

					<div id="div_campos">
						<p:outputPanel id="panelCampos" autoUpdate="true">

							<ui:insert name="camposOcultos" />

							<p:panelGrid id="display" columns="2"
								styleClass="customPanelGrid">
								<ui:insert name="campos" />
							</p:panelGrid>

						</p:outputPanel>
					</div>
				</div>

			</h:form>

		</div>


		<p:separator />
	</div>

</h:body>


</html>